package perform.query.impl;

import java.sql.Connection;

import perform.exception.QueryException;
import perform.mappings.ClassMappings;
import perform.query.AbstractQuery;
import perform.query.builder.QueryBuilder;
import perform.type.Type;

public class RetrieveQuery extends AbstractQuery {
	
	public RetrieveQuery(Type type, Connection connection) throws QueryException{
		super();
		try {
			query = QueryBuilder.getRetrieveQuery(type.getClass());
			preparedStatement = connection.prepareStatement(query);
			setValue(1, ClassMappings.getIDField(type.getClass()).get(type));
		} catch (Exception e) {
			throw new QueryException(e);
		}
	}

}
